package
{
import com.waitingsnow.core.base.BaseMobieSprite;
import com.waitingsnow.core.debug.Logger;
import com.waitingsnow.core.mobile.MobileUtil;

import flash.events.Event;
import flash.events.StageOrientationEvent;
import flash.system.Capabilities;

import test.Box2D_As3;
import test.TestAD;
import test.TestNativeAlert;
import test.TestVideo;

[SWF (width="640", height="960", frameRate=20)]
public class TestMobileAs extends BaseMobieSprite
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>TestMobileAs</code> instance.
	 * 
	 */
	public function TestMobileAs()
	{
		super();
	}
	
	//==========================================================================
	//  Methods
	//==========================================================================
	override protected function initDisplay():void
	{
		super.initDisplay();
		super.initDebugInfo(true);
		
//		testMobleUtil();
		testOrients();
//		testBox2d();
//		testAD();
		testNativeAlert();
		
		
		testVideo();
		
		
		
	}
	
	private function testNativeAlert():void
	{
		var alert:TestNativeAlert = new TestNativeAlert();
	}
	
	private function testAD():void
	{
		var ad:TestAD = new TestAD();
	}
	
	private function testVideo():void
	{
		var video:TestVideo = new TestVideo();
		video.x = video.y = 200;
		addChild(video);
	}
	
	private function testBox2d():void
	{
		/*var box2d:Box2D_ANE_Example = new Box2D_ANE_Example();
		addChild(box2d);*/
		addChild(new Box2D_As3());
	}
	
	private function testOrients():void
	{
		logSize();
		stage.autoOrients = false;
		Logger.debug("autoOrients: ", stage.autoOrients);
		stage.addEventListener(Event.RESIZE, resizeHandler);
		stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChangeHandler);
		stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChangingHandler);
	}
	private function resizeHandler(event:Event):void
	{
		Logger.debug("resize");
		logSize();
	}
	private function orientationChangeHandler(event:StageOrientationEvent):void
	{
		Logger.debug("orientationChangeHandler");
		logSize();
	}
	private function orientationChangingHandler(event:StageOrientationEvent):void
	{
		Logger.debug("orientationChangingHandler");
		logSize();
	}
	private function logSize():void
	{
		Logger.debug("stageWidth: ", stage.stageWidth, stage.stageHeight);
		Logger.debug("stage.fullScreenWidth: ", stage.fullScreenWidth, stage.fullScreenHeight);
		Logger.debug("Capabilities.screenDPI: ", Capabilities.screenDPI);
	}
	
	
	private function testMobleUtil():void
	{
		MobileUtil.callPhone("8618606191178");
//		MobileUtil.callSms("8618606191178");
//		MobileUtil.sendEmail("cgslendy@163.com?Subject=ddd&CC=271647527@qq.com&BCC=cgslendy@163.com&Body=ddssssaa");
	}
}
}
